In [1]:
import cv2
In [2]:
import matplotlib.pyplot as plt
In [3]:
img_gray = cv2.imread('bike.jpg',cv2.IMREAD_GRAYSCALE)
In [4]:
plt.imshow(img_gray, cmap='gray')
Out[4]:
In [5]:
plt.show()
In [6]:
print('Gray image shape:', img_gray.shape)
In [7]:
print('File_size:', img_gray.size/1024/8, 'KB')
In [8]:
img_cropped = img_gray[250:550,400:650]
In [9]:
plt.imshow(img_cropped, cmap='gray')
Out[9]:
In [10]:
plt.show()
In [11]:
print('Cropped image shape:', img_cropped.shape)
In [12]:
print('File_size_cropped:', img_cropped.size/1024/8, 'KB')